package com.sanyu.controller.admin;

import com.sanyu.pojo.dto.DeviceDTO;
import com.sanyu.pojo.dto.DevicePageQueryDTO;
import com.sanyu.pojo.vo.DeviceStatusVO;
import com.sanyu.pojo.vo.DeviceVO;
import com.sanyu.result.PageResult;
import com.sanyu.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/device")
@Api("后台管理页面/设备管理相关接口")
public class DeviceController {

    @GetMapping("/{id}")
    @ApiOperation("根据ID获取设备信息")
    public Result<DeviceVO> getDevice(@PathVariable Long id){
        DeviceVO deviceVO = new DeviceVO();
        return Result.success(deviceVO);
    }

    @GetMapping("/page")
    @ApiOperation("分页查询设备信息")
    public PageResult page(DevicePageQueryDTO devicePageQueryDTO){
        return new PageResult();
    }

    @PutMapping("/add")
    @ApiOperation("增加设备")
    public Result add(@RequestBody DeviceDTO deviceDTO){
        return Result.success();
    }

    @DeleteMapping("/delete/{id}")
    @ApiOperation("删除指定ID的设备")
    public Result delete(@PathVariable Long id){
        return Result.success();
    }

    @PutMapping
    @ApiOperation("修改设备信息")
    public Result update(@RequestBody DeviceDTO deviceDTO){
        return Result.success();
    }

    @GetMapping("/{id}/status")
    @ApiOperation("根据ID获取设备水质信息")
    public Result<DeviceStatusVO> getStatus(@PathVariable Long id){
        DeviceStatusVO devicestatusvo = new DeviceStatusVO();
        return Result.success(devicestatusvo);
    }

    @PostMapping("/switchStatus/{status}")
    @ApiOperation("修改设备水阀状态")
    public Result setSwitchStatus(@PathVariable int status){
        return Result.success();
    }
}
